#ifndef BLUETOOTH_H
#define BLUETOOTH_H

/* includes from Std Librarys */	
	#include "stm32f10x.h"
	#include "stm32f10x_tim.h" //for toggle LED function
	#include "stm32f10x_adc.h" //for ADC Trigger activation
	#include "stm32f10x_gpio.h" //for ADC Trigger activation
	#include "stm32f10x_dma.h" //for ADC dma interaction
	#include "MEDKit_HW_Init.h" // for hardware related functions
	#include "stm32f10x_dac.h" // for analog debug output of variables
	#include "stm32f10x_usart.h" //for USART

/* includes for TargetLink Code */
	#include "tl_basetypes.h"
	#include "MEDKit_IO.h"
	#include "MEDKit_Modul_Interfaces.h"
	#include "TRQ_Controller.h"
	#include "RPM_Controller.h"      
	#include "POS_Controller.h"
	#include "IHS.h"
	#include "LED_Block_Driver.h"
	#include "SVPWM.h"
	#include "Bus_Current_Filter.h"
	#include "State_Manager.h"

/* special function variables */
    #define BT_Tx_BufferSize   32	/*Size of Bluetooth Transmit Buffer*/
	volatile uint8_t BT_Tx_Buffer[BT_Tx_BufferSize];  // BT-Sendbuffer
	volatile uint8_t *pBT_Tx_Fill = &BT_Tx_Buffer[0]; // BT-Fillpointer
	volatile uint8_t *pBT_Tx_Send = &BT_Tx_Buffer[0]; // BT-Sendpointer

	uint8_t BT_Rx_Byte = 0;   // BT received byte
	uint8_t BT_Rx_Count = 1;  // BT byte counter
    uint8_t BT_Rx_Length = 0; // BT message length
    uint8_t BT_Rx_Id;         // BT message id
	uint8_t BT_Tx_Id=0;		  // BT Sende-Counter (0-100)

/* special function prototypes */
    void BT_receive();                           // BT receive function
    void BT_send();                              // BT send function
    void BT_Write_Message(char , char , char *); // BT write message to buffer
    void BT_Write_Buffer (char );                // BT write byte to buffer
    void BT_send_continuous();                   // BT send loop
    void BT_send_speed();                        // BT send speed
    void BT_send_current();                      // BT send current
    void BT_send_voltage();                      // BT send voltage
    void BT_send_temperature();                  // BT send temperature
    void BT_send_status();                       // BT status

#endif /* __MAIN_H */
